import React, { Component } from 'react'
import "./honorinfo.scss";
import Header from '../../components/Header/header'
import Footer from '../../components/Footer/footer'  
import { getApiHonerInfo } from '../../axios/api'; 
import { UrlSearch , get  } from '../../axios/localstorage';

export default class honorinfo extends Component {

    state = {
        content:"<p>测试1234</p>",
        data:{},
    }

    componentWillMount(){

        window.scroll(0,0);

        let id = UrlSearch('id');

        getApiHonerInfo({id:id})
        .then( req =>{
            if(req.data.code === 1){
                let data = req.data.data;
                this.setState({
                    data
                })
            }
        }).catch( err =>{
            console.error(err);
        })
    }

    gotoPage=(page)=>{
        this.props.history.push(page);
    }


    render() {
        return (
            <div className='honorinfo'>
                <Header />
                <div className='pmain'>
                    <div className='page1' style={{backgroundImage:"url('assets/img/rongyubeijing.png')"}}>
                        <div className='pm'>
                            <div className="cleft">
                                <img className="img" alt="" src="assets/imgs/dingwei.png" />
                                <p className="p_point" onClick={()=>{
                                    if(get('type')){
                                        // this.gotoPage('/index')
                                        this.gotoPage('/home')
                                    }else{
                                        this.gotoPage('/home')
                                    }
                                }}>首页</p>
                                <img className="icon" alt="" src="assets/img/xiaji.png" />
                                <p className="p_point" onClick={()=>{window.history.go(-1)}}>荣誉展示</p>
                                <img className="icon" alt="" src="assets/img/xiaji.png" />
                                <p>荣誉详情</p>
                            </div>
                            <div className='name'>
                                <img alt="" src="assets/img/ringyuzhanshi.png" />
                                <h2>荣誉展示</h2>
                                <p>百万荣誉，超强资质</p>
                            </div>

                            <div className="info">
                                <div className="ileft" style={{backgroundImage:"url('"+this.state.data.image+"')"}}></div>
                                <div className="iright">
                                    <h2>{this.state.data.title}</h2>
                                    <p>{this.state.data.summary}</p>
                                </div>
                            </div>
                        </div>  
                    </div>

                    <div className='page2'>
                        <div className='pm'>
                            <div className='chead'>
                                <div className="citem c_active">
                                    详情介绍
                                    <div className="icen"><span></span></div>
                                </div>
                            </div>

                            <div className="cbox">
                                <div className="cont" dangerouslySetInnerHTML={{
                                        __html: this.state.data.content
                                    }}></div>
                            </div>
                        </div>
                    </div>
                </div>


                <Footer />
            </div>
        )
    }
}
